﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.DAO;
using ClassLibrary.Entity;
using ClassLibrary.Data;
using System.IO;
using System.Text;

public partial class en_LayoutCode : System.Web.UI.Page
{
    TblLayoutCodeDAO LayoutCodeDAO = new TblLayoutCodeDAO(Global.CONNECTION_STRING);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session[Global.SESSION_LOGGED_USER] != null)
            {
                int TypeAcc = ((TblAccounts)Session[Global.SESSION_LOGGED_USER]).TypeAcc;
                if (TypeAcc == 4)
                {
                    LoadLayoutById();
                }
                else
                {
                    lblMessenger.Text = "you must have a V.I.P account to perform this function ";
                    FCKeditor1.Visible = false;
                }
            }
            else {
                lblMessenger.Text = "Login before Edit Code Layout, Please";
                FCKeditor1.Visible = false;
            }
        }
    }

    private void LoadLayoutById()
    {
        string idLayout = Request.QueryString["idLayout"];
        TblLayoutCode Layout = LayoutCodeDAO.GetLayoutByID(Convert.ToInt32(idLayout));
        
        FCKeditor1.Value = Layout.CodeDetails;
    }
    
}
